package core

class Person {
	
	String firstName
	String lastName
	Date birthDate
	String fullName
//	gender
//	meritalStatus
	static hasMany = [legalIdentifiers: LegalIdentifier]
	
	List legalIdentifier
	String toString() {
		firstName + ' ' + lastName + ' ' + ' ' + birthDate?.format('YY-MM-DD')
			}
//static hasMany = [legalIdentifiers: LegalIdentifier, nationalities: Nationality, personAddresses: PersonAddress]
	  
	
	   static transients = ['age']
	   int getAge() {
		   (new Date() - birthDate)/365.25
	   }

    static constraints = {
		fullName nullable: true
		firstName blank:false
		lastName blank:false
		birthDate blank:false
		
    }
}
